package com.sjgtw.cloud.system.api.fallbackfactory;

import com.sjgtw.cloud.common.core.domain.R;
import com.sjgtw.cloud.system.api.service.RemoteConfigService;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * <p>Title: 用户服务异常处理</p>
 * <p>Description: </p>
 * @author Admin
 * @date 2021-4-7
 */
@Component
public class RemoteConfigFallbackFactory implements FallbackFactory<RemoteConfigService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteConfigFallbackFactory.class);

    @Override
    public RemoteConfigService create(Throwable throwable)
    {
        log.error("认证服务调用失败:{}", throwable.getMessage());
        return new RemoteConfigService()
        {
            @Override
            public R<String> getConfigByKey(String configKey) {
                return null;
            }
        };
    }
}
